import Request from '../utils/request'
import { AcceptDepartment, ApprovalQuery, RelationTask, ReportRequest } from './types/report'
import { Wrapper } from './types/result'
import { TargetUser } from './types/task'

/**
 * 获取关联任务
 */

 export function getRelationTask () {
  return Request<Wrapper<Array<RelationTask>>>({
    url: '/api/app/tasktargetinfo/relationTask',
    method: 'GET'
  })
}

/**
 * 获取接收人和接收部门
 */

 export function getAcceptAndUser () {
  return Request<Wrapper<Array<AcceptDepartment>>>({
    url: '/api/app/org/getReceiveUser',
    method: 'POST'
  })
}
/**
 * 获取审批人
 */

 export function getApprovalUser (query: ApprovalQuery) {
  return Request<Wrapper<TargetUser>>({
    url: '/api/app/platformReportInfo/getApproval',
    method: 'GET',
    params: query
  })
}
/**
 * 上报发起
 */

export function report (query: ReportRequest) {
  return Request<Wrapper<boolean>>({
    url: '/api/app/platformReportInfo',
    method: 'POST',
    data: query
  })
}

